<?php
namespace Home\Controller;
use Think\Controller;
use Org\Net\Http;
class IndexController extends Controller {
    public function index(){
    	$http = new Http();
    	$url = C('BAIDU_GEOTABLE_LIST')."?ak=".C('BAIDU_AK');
    	$back = json_decode($http->fsockopenDownload($url),'json');
    	var_dump($back);
    }
    public function scenic_list(){
    	$http = new Http();
    	$geotable_id = 111203;
    	$url = C('BAIDU_POI_LIST')."?ak=".C('BAIDU_AK')."&geotable_id={$geotable_id}&page_size=635";
    	$back = json_decode($http->fsockopenDownload($url),'json');
    	var_dump($back);
    }
    public function lbs(){
    	$http = new Http();
    	$geotable_id = 111203;
    	$url = C('BAIDU_POI_LIST')."?ak=".C('BAIDU_AK')."&geotable_id={$geotable_id}";
    	$back = json_decode($http->fsockopenDownload($url),'json');
    	$total = $back['total'];
    	$url = C('BAIDU_POI_LIST')."?ak=".C('BAIDU_AK')."&geotable_id={$geotable_id}&page_size={$total}";
    	$back = json_decode($http->fsockopenDownload($url),'json');
    	
    	$arr = $back['pois'];
    	foreach ($arr as $value){
    		$pois[] = $value['location'];
    	}
    	$this->assign("total",$total);
    	$this->assign("pois",$pois);
    	$this->display();
    }
}